﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Dune2013
{
    public class AlmacenarBehavior : Behavior
    {
        public float velocidadDescarga;
        public AlmacenarBehavior(float velocidadDescarga) :
            base(){
                typeBehavior = TypeBehavior.Trabajo;
                this.velocidadDescarga = velocidadDescarga;
            }
        public override void execute(int dTime,Actor act)
        {

            base.execute(dTime,act);
            act.scale -= velocidadDescarga/100;
            Recolector pepe = (Recolector) act;
            pepe.carga -= velocidadDescarga;
            if (pepe.carga <= 0)
            {
                pepe.changeBehavior(new IrCosecharBehavior());
            }
        }
        public override void enter(Actor act)
        {
            act.speed = 0;
            base.enter(act);
        }
        public override void exit(Actor act)
        {
            base.enter(act);
        }
        public override Behavior getIrABehavior() {
            return new IrAlmacenarBehavior();
        }
    }
}
